from helpers.director.shortcut import ModelTable,TablePage,ModelFields,director,page_dc
from .models import FailAbstract

class FailAbstractPage(TablePage):
    def get_label(self):
        return '不良内容简述'
    
    def get_template(self, prefer=None):
        return 'jb_admin/table_new.html'
    
    class tableCls(ModelTable):
        model = FailAbstract
        exclude =[]
        pop_edit_fields = ['id']
        
        def dict_head(self, head):
            width = {
                'desp':300
            }
            head['width'] = width.get(head['name'])
            return head

class FailAbstractForm(ModelFields):
    class Meta:
        model = FailAbstract
        exclude =[]

director.update({
    'FailAbstract':FailAbstractPage.tableCls,
    'FailAbstract.edit':FailAbstractForm
})

page_dc.update({
    'FailAbstract':FailAbstractPage
})